/**
 * 
 */
package core.factory;

import core.proxy.WFQueueManagerProxy;
import core.proxy.WFQueueManagerProxyP2P;
import core.util.COREServiceRegistry;
import org.apache.log4j.Logger;

/**
 * Classe Factory singleton che si occupa della costruzione del proxy relativo al WFQueueManager
 * @author Vincenzo Merlo, Scuderi Giovanni Luca, Paolo Giuffrida
 *
 */
public class WFQProxyFactory {

    private final Logger logger = COREServiceRegistry.getLogger(WFQProxyFactory.class.toString()); // istanza logger log4j
    static WFQProxyFactory instance = null; //istanza per il singleton
    private WFQueueManagerProxy proxy ; // proxy di comunicazione

    private WFQProxyFactory() {
        logger.debug("WFQueueProxyFactory");
        proxy = new WFQueueManagerProxyP2P();
    }

    /**
     * metodo singleton
     * @return
     */
    public static WFQProxyFactory getInstance() {
        if (instance != null) {
            return instance;
        }
        instance = new WFQProxyFactory();
        return instance;
    }

    /**
     * metodo factory che ritorna il proxy relativo al WFQueueManager
     * @return istanza WFQueueManagerProxy
     */
    public WFQueueManagerProxy getProxy() { //factory to services
        logger.debug("getProxy");
        
        return proxy; //call the real object
    }
}
